import React from 'react';
import {Button} from 'antd';
import styles from './index.less';
import {connect} from 'dva';
export default connect(
  // mapStateToProps
 ({ more, goods }) => ({ more, goodsList: goods }),
 // mapDispatchToProps
  {
    addGood: title => ({type: 'goods/addGoods', payload: {title}}),
 getMoreData: values => ({ type:
 'more/moreData', payload: values }),
 // getMoreDataBySearch: values => ({
 // type: 'more/getMoreDataBySearch',
 // payload: values,
 // }),
  },
)(function Page(props) {
  const {goodsList, userList, addGood, getMoreData, more} = props;
  console.log('---->', props);
  console.log('more: ', more);
  console.log('goodsList: ', goodsList);
  // console.log('userList: ', userList);
  return (
    <div>
      <h1 className={styles.title}>Page goods/index</h1>
      <hr/>
      <ul>
        {goodsList.map((item: any, index: number) => <li key={index}>{item.title}</li>)}
      </ul>
      <button onClick={() => {
         addGood('张三' + new Date().toLocaleString())
        // console.log(props);
        // getMoreData({data: {name: '张三' + new Date().toLocaleTimeString()}});
      }}>添加</button>
      <p>{}</p>
      <Button type="primary">请求数据</Button>
    </div>
  );
});
